<?php

namespace App\Http\Controllers\Admin;

use App\Http\Controllers\Controller;
use App\Models\ArticleModel;
use Illuminate\Http\Request;

class ArticleController extends Controller
{
    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function index(Request $request)
    {
        $pagesize = config('page.pagesize');
        $data = ArticleModel::paginate($pagesize);
        return view('admin.article.index',compact('data'));
    }

    /**
     * Show the form for creating a new resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function create()
    {
        //
    }

    /**
     * Store a newly created resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
    public function store(Request $request)
    {
        //
    }

    /**
     * Display the specified resource.
     *
     * @param  \App\Models\ArticleModel  $articleModel
     * @return \Illuminate\Http\Response
     */
    public function show(ArticleModel $articleModel)
    {
        //
    }

    /**
     * Show the form for editing the specified resource.
     *
     * @param  \App\Models\ArticleModel  $articleModel
     * @return \Illuminate\Http\Response
     */
    public function edit(ArticleModel $articleModel)
    {
        //
    }

    /**
     * Update the specified resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \App\Models\ArticleModel  $articleModel
     * @return \Illuminate\Http\Response
     */
    public function update(Request $request, ArticleModel $articleModel)
    {
        //
    }

    /**
     * Remove the specified resource from storage.
     *
     * @param  \App\Models\ArticleModel  $articleModel
     * @return \Illuminate\Http\Response
     */
    public function destroy(ArticleModel $articleModel,$id)
    {
        $articleModel->where('id',$id)->delete();
        return redirect(route('admin.article'));
    }
}
